home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 September / 1992-09.d64 / smart format (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  79 lines

  1. 0 clr
  2. 100 rem 'smart format v1.0' by rustin ambrose 1992
  3. 110 :
  4. 120 rem ** a$ must be first variable used in program **
  5. 130 a$="":c0$=chr$(0):cr$=chr$(13):va=peek(45)+256*peek(46)
  6. 140 poke(va+2),255:poke(va+3),0:poke(va+4),192
  7. 150 print"--setting up. . ."
  8. 160 forad=49176to49375:readx:pokead,x:nextad
  9. 170 poke53280,0:poke53281,0
  10. 180 print"[147][155]";chr$(14)
  11. 190 print"***********[211][205][193][210][212][160][198][207][210][205][193][212] [214]1.0***********"
  12. 200 printcr$spc(11)"1541 fast format"cr$spc(12)"without 'bump'"
  13. 210 printcr$spc(11)"by [210]ustin [193]mbrose"
  14. 220 print"[197][206][212][197][210]:  diskette name,id"
  15. 230 print"(name can have max of 16 chars,"
  16. 240 print" i.d. must be 2 chars long)";cr$
  17. 250 dn$="":id$="":inputdn$,id$:if(dn$="")or(id$="")thenend
  18. 260 ln=len(dn$):ifln>16thenprintcr$"--name too long.":goto220
  19. 270 iflen(id$)<>2thenprintcr$"--i.d. not 2 characters long.":goto220
  20. 280 cs$="n0:"+dn$+chr$(44)+id$+chr$(13):cl=len(cs$):poke49175,cl
  21. 290 fori1=1tocl:poke49151+i1,asc(mid$(cs$,i1,1)+c0$):nexti1
  22. 300 :
  23. 310 close15:open15,8,15
  24. 320 print#15,"m-r"chr$(34);c0$:get#15,t$:ifasc(t$+c0$)then380
  25. 330 printcr$"**[201]nternal track counter of drive needs"
  26. 340 print"  to be initialized."
  27. 350 print"  [208]lease insert [193][206][217] formatted diskette."
  28. 360 print"  [212]he diskette will not be affected**":gosub630
  29. 370 print#15,"i0":gosub700:goto320
  30. 380 printcr$"**[208]lace diskette to be formatted into"
  31. 390 print"  drive**":gosub630
  32. 400 print#15,"m-r"chr$(30);c0$:get#15,wp$:ifasc(wp$+c0$)and16then430
  33. 410 printcr$"--write protect is on."
  34. 420 print"--replace diskette.":gosub630:goto400
  35. 430 printcr$"**[208]lease re-check that diskette in"
  36. 440 print"  drive should be formatted."
  37. 450 print"  [193]ll data will be destroyed!**"
  38. 460 printcr$spc(7)"[[200][201][212] [211][208][193][195][197] [194][193][210] [212][207] [198][207][210][205][193][212]":gosub640
  39. 470 print#15,"m-r"chr$(34);c0$:get#15,t$:ifasc(t$+c0$)=0then330
  40. 480 print#15,"m-r"chr$(30);c0$:get#15,wp$:if(asc(wp$+c0$)and16)=0then410
  41. 490 printcr$"--formatting '"dn$","id$"' . . ."
  42. 500 print#15,"m-w"chr$(28);c0$;chr$(1);c0$
  43. 510 open2,8,2,"#1":print#15,"b-p";2;0:print#2,a$;:close2
  44. 520 print#15,"m-e"chr$(28);chr$(4):gosub700
  45. 530 printcr$"--done.   [i.s. gaps: ";
  46. 540 print#15,"m-r"chr$(5)chr$(6)chr$(4)
  47. 550 fori1=0to3:get#15,g$:g(i1)=asc(g$+c0$):nexti1
  48. 560 fori1=3to0step-1:printg(i1);:nexti1:print"]"
  49. 570 printspc(10)"[# of re-tries:";
  50. 580 print#15,"m-r"chr$(32)chr$(6):get#15,er$:er=asc(er$+c0$)
  51. 590 print10-er"]"
  52. 600 close15:printcr$"**[198]ormat another?**":gosub630:goto220
  53. 610 :
  54. 620 :
  55. 630 printcr$spc(7)"[[200][201][212] [211][208][193][195][197] [194][193][210] [212][207] [195][207][206][212][201][206][213][197]"
  56. 640 printspc(11)"[207][210] '[197]' [212][207] [197][216][201][212]]"
  57. 650 poke198,0
  58. 660 geti$:ifi$="e"thenclose15:end
  59. 670 ifi$<>" "then660
  60. 680 return
  61. 690 :
  62. 700 input#15,e1$,e2$,e3$,e4$:ife1$="00"thenreturn
  63. 710 printcr$"[196][210][201][214][197] [197][210][210][207][210] #"e1$":"
  64. 720 print"'"e2$"' [212][210][193][195][203]#"e3$" [211][197][195][212][207][210]#"e4$:close15:end
  65. 730 :
  66. 740 data1,4,10,0,174,23,4,134,163,189,255,3,157,255,1,202
  67. 750 data208,247,160,70,162,193,169,132,32,93,4,32,48,6,160,13
  68. 760 data162,238,169,61,32,93,4,32,48,6,160,54,162,252,169,174
  69. 770 data32,93,4,169,76,141,0,6,169,123,141,1,6,169,4,32
  70. 780 data210,200,76,64,238,140,105,4,142,106,4,141,3,6,162,0
  71. 790 data189,255,255,157,48,6,232,200,204,3,6,208,243,169,96,157
  72. 800 data48,6,96,165,81,16,19,169,6,141,33,6,169,15,141,34
  73. 810 data6,169,10,141,32,6,169,1,133,81,160,0,209,50,240,13
  74. 820 data201,2,208,6,174,38,6,142,4,6,76,251,250,201,1,240
  75. 830 data52,165,68,74,74,74,74,74,170,189,24,4,24,109,4,6
  76. 840 data157,5,6,141,38,6,32,48,6,173,12,28,41,31,9,192
  77. 850 data141,12,28,169,255,141,3,28,169,85,141,1,28,162,2,32
  78. 860 data36,254,76,177,252,76,0,251
  79.